package org.mappland.compltres.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

// 用户信息返回类
@Data
public class ReturnUserDTO {
    private Integer id;

    /**
     * 日期时间格式模式，用于指定日期和时间的字符串表示形式。
     * 格式："yyyy-MM-dd HH:mm" 表示四位数的年份、两位数的月份、两位数的日、
     * 两位数的小时（24小时制）和两位数的分钟，各部分之间用连字符和空格分隔。
     */
    private static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm";
    @DateTimeFormat(pattern = DATE_TIME_PATTERN)
    @JsonFormat(pattern = DATE_TIME_PATTERN, shape = JsonFormat.Shape.STRING)
    private LocalDateTime createTime;

    private String email;
    private String userName;
    private Integer sex;
    private String phone;
    private Integer points = 0;
    private Integer state = 0;

    @Override
    public String toString() {
        return "ReturnUserDTO{" +
                "id=" + id +
                ", createTime=" + createTime +
                ", email='" + email + '\'' +
                ", userName='" + userName + '\'' +
                ", sex=" + sex +
                ", phone='" + phone + '\'' +
                ", points=" + points +
                ", state=" + state +
                '}';
    }
}
